package com.mit.wx.dto;

import com.mit.wx.entity.Admin;
import lombok.Data;
import org.springframework.beans.BeanUtils;

/**
 * 2018/10/20 Create by 郭文梁
 * AdminDto
 * 管理员数据传输对象
 *
 * @author 郭文梁
 * @date 2018/10/20
 */
@Data
public class AdminDto {
    public static final String COOKIE_NAME = "AccessToken";
    public static final String IN_SESSION_NAME = "admin";

    /**
     * 从Admin实体对象创建AdminDto
     *
     * @param admin 实体对象
     * @return DTO
     */
    public static AdminDto of(Admin admin) {
        AdminDto dto = new AdminDto();
        BeanUtils.copyProperties(admin, dto);
        return dto;
    }

    private Integer id;
    private String name;
    private String password;
    private String openId;
}
